
public class JavaText {

    public static void fun() {
        //(for循环)计算1+2+3+...+100的和。
        int sum = 0;
        for(int i =1;i<=100;i++) {
            sum+=i;
        }
      System.out.println(sum);
    }
    public static void fun1() {
        //(for循环)计算1+3+5+...+99
        int sum = 0;
        for (int i = 0; i < 100; i+=2) {
            sum +=i;
        }
        System.out.println(sum);
    }
    public static  void fun2() {
        //求100以内能被3整除不能被5整除的数字和
        int sum = 0;
        for (int i = 0; i < 100; i++) {
            if (i%3 == 0 && i%5 != 0) {
                sum+=i;
            }
        }
        System.out.println(sum);
    }
    public static void main(String[] args) {
       fun();
       fun1();
       fun2();
    }
}